package com.naiterui.common.redis.util;

import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.data.redis.serializer.SerializationException;

/**
 * 自定义Redis序列化工具类
 * 保证与原component-redis序列化方式统一，用以兼容线上Redis已序列化的对象数据
 */
public class CustomerSerialize implements RedisSerializer<Object> {

    @Override
    public byte[] serialize(Object o) throws SerializationException {
        return SerializeUtil.serialize(o);
    }

    @Override
    public Object deserialize(byte[] bytes) throws SerializationException {
        return SerializeUtil.unserialize(bytes);
    }
}
